package com.dotflat.fin.domain;

import com.dotflat.rest.domain.AreableObjectBase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.util.Date;

/**
 *  收费计划
 */

@Data
@Entity
@Table(name="fin_plan")
@EqualsAndHashCode(callSuper = true)
public class FinPlan extends AreableObjectBase {
    // 计划名称 计划类型 日期 金额  状态 说明
    @Column(columnDefinition = "VARCHAR(32) COMMENT '计划名称'", nullable = false)
    private String name;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '账单号基准'", nullable = false, unique = true)
    @ApiModelProperty("账单号基准, 支付账单的订单号以这个为基准")
    private String orderSnBase;

//    @Column(columnDefinition = "INT(3) default 0 COMMENT '计划类型, 0:综合  1:预存'")
//    private Integer category = 0;

    @Column(columnDefinition = "DATETIME COMMENT '开始日期'", nullable = false)
    private Date beginDate;

    @Column(columnDefinition = "DATETIME COMMENT '结束日期'", nullable = false)
    private Date endDate;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '账单标题'", nullable = false)
    private String title;

    @Column(columnDefinition = "INT COMMENT '总金额'")
    private Long amount;

    @Column(columnDefinition = "INT COMMENT '已付费金额'")
    private Long paiedAmount;

    @Column(columnDefinition = "INT COMMENT '账单总数量'")
    private Long orderCount;

    @Column(columnDefinition = "INT COMMENT '已付费账单数'")
    private Long paiedOrderCount;

    @Column(columnDefinition = "INT COMMENT '通知过的总数量'")
    private Long notifyCount;

    @Column(columnDefinition = " bit(1) DEFAULT 0 COMMENT '作废' ", nullable = false)
    private Boolean cancelled = false;
}
